package com.atguigu.dao.impl;

import com.atguigu.bean.OrderItem;
import com.atguigu.dao.BaseDao;
import com.atguigu.dao.OrderItemDao;

import java.util.List;

/**
 * Date:2020/9/16
 * Author:ybc
 * Description:
 */
public class OrderItemDaoImpl extends BaseDao<OrderItem> implements OrderItemDao {
    @Override
    public void saveOrderItem(OrderItem orderItem) {
        String sql = "insert into bs_orderItems values(null,?,?,?,?,?,?,?)";
        update(sql, orderItem.getTitle(), orderItem.getAuthor(), orderItem.getPrice(), orderItem.getImgPath(), orderItem.getCount(), orderItem.getAmount(), orderItem.getOrderId());
    }

    @Override
    public List<OrderItem> getDetails(String orderId) {
        String sql = "select * from bs_orderItem where orderId = ?";
        return getBeanList(OrderItem.class, sql, orderId);
    }
}
